package com.um.jdy.mp.commission.contoller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import com.um.jdy.mp.commission.entity.dto.BankCardDTO;
import com.um.jdy.mp.commission.entity.vo.BankCardItemVO;
import com.um.jdy.mp.commission.manager.BankCardManager;
import com.um.springboot.starter.orm.controller.BaseController;
import com.um.springboot.starter.orm.entity.Response;
import com.um.springboot.starter.orm.params.ListParams;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 方案管理
 *
 * @author cs
 * 日期 2023/6/2
 * 版权所有 广州优匠科技有限公司
 */
@Api(tags = "银行卡管理")
@Validated
@RestController
@RequestMapping("/api/v1/cms/user/bank")
@SaCheckLogin
public class BankCardController extends BaseController<BankCardManager> {

    /**
     * 列表
     * @return
     */
    @ApiOperation(value = "列表")
    @GetMapping("list")
    public Response<List<BankCardItemVO>> list() {
        ListParams params = new ListParams();
        return manager.list(params);
    }

    /**
     * 新增
     * @param dto
     * @return
     */
    @ApiOperation(value = "新增")
    @PostMapping
    public Response add(@RequestBody BankCardDTO dto) {
        return manager.add(dto);
    }

    /**
     * 删除
     * @param id
     * @return
     */
    @ApiOperation(value = "删除")
    @DeleteMapping("{id}")
    public Response delete(@ApiParam(value = "银行卡ID") @PathVariable String id) {
        return manager.delete(id);
    }

}
